﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OAPlatform.DomainModel.Model
{
    public class Band : AuthenticatableEntity
    {
        public Band()
        {
            Department = new Department();
            Users = new List<User>();
        }

        public string Name { get; set; }
        public long DepartmentID { get; set; }

        public virtual Department Department { get; set; }
        public virtual IList<User> Users { get; set; }

        /// <summary>
        /// 测试该职位是否有所指定的权限
        /// 权限包括职位自有权限和从部门继承的权限
        /// </summary>
        /// <param name="permissionKey">需要测试的权限标识</param>
        /// <returns>有则返回true，否则返回false</returns>
        public override bool Authenticate(string permissionKey)
        {
            return base.Authenticate(permissionKey) || Department.Authenticate(permissionKey);
        }
    }
}
